#!/usr/bin/env bash
. ./wvtest-bup.sh

set -o pipefail

top="$(WVPASS pwd)" || exit $?
tmpdir="$(WVPASS wvmktempdir)" || exit $?

# undo the ban in ./pytest
WVPASS test -L bup -a -f lib/cmd/bup.c
unset GIT_DIR

WVPASS dev/make PREFIX="$tmpdir/install" install

WVPASS cd "$tmpdir"

export PATH="$tmpdir/install/bin:$PATH"
WVPASS bup version
if test "$(type -p pandoc)"; then
    WVPASS bup help save | WVPASS grep 'bup-save - create a new bup backup set'
else
    WVSKIP 'pandoc not installed, skipping help test'
fi
WVPASS bup -d "$tmpdir/repo" init

WVPASS cd "$top"
WVPASS rm -rf "$tmpdir"
